package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 会员状态：1-未开通，2-已开通，3-已过期
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum MemberStateEnum {
    NO(1, "未开通"),
    YES(2, "已开通"),
    EXPIRE(3, "已过期"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    MemberStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static MemberStateEnum typeOf(Integer value) {
        MemberStateEnum[] values = MemberStateEnum.values();
        for (MemberStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static MemberStateEnum typeOf(String name) {
        MemberStateEnum[] values = MemberStateEnum.values();
        for (MemberStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
